package com.one.blocks.rbac.constant;

import lombok.experimental.UtilityClass;

/**
 * @author linfuxin Created on 2022-02-14 14:18:42
 */
@UtilityClass
public class RbacConstant {

    public static final Integer DEFAULT_TENANT_ID = 1;

    public static final String PERMS_SPLIT = ",";


    public static final String HEADER_PLATFORM_KEY = "platform";
    public static final String HEADER_PLATFORM_MINI_APP = "miniApp";

    public static final class DictDataCache {
        public static final String AREA = "dictData";

        public static final String NAME = "dictData:";
        public static final String TYPE_CODE = "'typeCode:'";

        public static final String CLEAR_PREFIX = "dictData:*";
    }

    public static final class TokenCache {
        public static final String AREA = "token";
        public static final String PREFIX = "token:";
    }

    public static final class RoleCache {
        public static final String AREA = "role";

        public static final String NAME = "role:";

        public static final String USER_ID = "'userId:'";
    }

    public static final class OrgCache {
        public static final String AREA = "org";
        public static final String NAME = "org:";
    }

    public static final class UserCache {
        public static final String AREA = "user";
        public static final String NAME = "user:";
    }

    public static final class MenuCache {
        public static final String AREA = "menu";
        public static final String NAME = "menu:";

        public static final String PERMS_ROLE_ID = "'perms:roleId:'";
        public static final String MENU_ROLE_ID = "'roleId:'";
    }

    public static final class ScopeRequest {
        public static final String ROLES_OF_USER_ID = "rbac:roles:user:";
        public static final String VALID_MENU_ID = "valid:menu:row:";

        public static final String VALID_ORG_ID = "valid:org:row:";
        public static final String VALID_ORG_CHILDREN_FULL_CODE = "valid:org:children:full-code:";
        public static final String VALID_ORG_CHILDREN_OF_ORG_ID = "valid:org:children:";
    }
}
